package mylibrary.outofmemory;

/**
 * VM Args：-Xss2M
 * @author gaoshuai
 *
 */

public class JavaVMStackOOM {

	private void dontStop() {
		while(true){
			
		}
	}
	
	public void stackLeakByThread() {
		while(true) {
			Thread thread = new Thread(new Runnable(){
				public void run() {
					dontStop();
				}
			});
			thread.start();
		}
	}
	
	public static void main(String[] args) {
		
		JavaVMStackOOM oom = new JavaVMStackOOM();
		oom.stackLeakByThread();
	}
}
